#include "main.h"

/*************/
/*  Globals  */
/*************/

extern unsigned selection_Status=0;
//0:menu; 1:play;

extern unsigned selection_selector=1;
//1:play; 2:music library; 3:visual; 4:EQ;...9:quit

extern unsigned selection_selector_bakup=0;
//为了每次退出能保留位置

extern unsigned whatKindOfMusicDoYouLike=1;
//1:ATRAC; 2:MP3; 3:FLAC

extern unsigned play_status=0;
//0:stop; 1:playing; 2:pause;

extern int Exit=1;

extern unsigned play_load=0;

extern struct top_list list[1000];

extern struct in_list info;


void playing(){
    Gui_loadPlayingImages();
    int quit=1;
    while(quit){
        #ifdef DEBUG
        ShowFps();
        #endif
        
        Ctrl_Playing(&quit);
        Gui_playing();
    }
    Gui_freeImagePlaying();
}

void menu(){
    Gui_loadMenuImages();
    int quit=1;
    while(quit){
        #ifdef DEBUG
        ShowFps();
        #endif
        
        Ctrl_Menu(&quit);
        Gui_menu();
    }
    Gui_freeImageMenu();
}

void main(){
					  #ifdef DEGUG
					  u_log("Init NGE...\n");
					  #endif
    NGE_Init(INIT_VIDEO);
						  #ifdef DEGUG
						  u_log("Init Ctrl...\n");
						  #endif
    InitInput(NULL,NULL,0);
						  #ifdef DEGUG
						  u_log("Init GUI...\n");
						  #endif
    Gui_init();
						  #ifdef DEGUG
						  u_log("Start loop...\n");
						  #endif
    
    while(Exit){
        switch(selection_Status){
            case 0:
                menu();
                break;
            case 1:
                playing();
                break;
        }
    }
    Gui_freeImageCommon();
    Gui_distroyFonts();
	NGE_Quit();
	return NULL;
}